package com.tianmao.swing.core;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class WriteFile {
    public void writeFile(String data) {
        String filePath = "template.txt";
        String contentToWrite = data;

        try (BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))) {
            writer.write(contentToWrite);
            System.out.println("写入完成");
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println("WriteFile receive:"+data);
    }
}
